package com.clean.cleantotal.pop

import android.content.Context
import android.graphics.Color
import android.widget.TextView
import com.blankj.utilcode.util.SpanUtils
import com.clean.cleantotal.R
import com.lxj.xpopup.core.BasePopupView

class BackPop(context: Context, val size: String, val out: () -> Unit, val clean: () -> Unit) :
    BasePopupView(context) {
    override fun onCreate() {
        super.onCreate()

        val content = findViewById<TextView>(R.id.content)
        findViewById<TextView>(R.id.out).setOnClickListener { dismiss();out.invoke() }
        findViewById<TextView>(R.id.clean).setOnClickListener { dismiss(); clean.invoke() }

        SpanUtils.with(content).append("You have ").append(size).setForegroundColor(
            Color.parseColor("#06C28B")
        ).append(" trash has not been cleaned up.").create()
    }

    override fun getInnerLayoutId(): Int {
        return R.layout.pop_back_layout
    }
}